import { defHttp } from '/@/utils/http/axios';
import { IPostCustomerUpdateRaw } from '/@/types/system/basic/customer/update';
import { IPostCustomerDeleteQuery } from '/@/types/system/basic/customer/delete';
import {
  IPostCustomerListRequest,
  IPostCustomerListResponse,
} from '/@/types/system/basic/customer/list';
import { IGetRawCustomerDetailsResponse } from '/@/types/system/basic/customer/details';
import { IGetCustomerCheckNumberIsExistQuery } from '/@/types/system/basic/customer/checkNumberIsExist';
import { IPostCustomerAddRequest } from '/@/types/system/basic/customer/add';

/**
 * 修改客户信息
 */
export const apiPostCustomerUpdatePath = (id: string | number, params: IPostCustomerUpdateRaw) =>
  defHttp.post({ url: `/system/basic/customer/update/${id}`, params });
/**
 * 删除客户信息
 */
export const apiPostCustomerDeleteQuery = (params: IPostCustomerDeleteQuery) =>
  defHttp.post({ url: `/system/basic/customer/delete`, params });
/**
 * 客户信息列表
 */
export const apiPostCustomerList = (params: IPostCustomerListRequest) =>
  defHttp.post<IPostCustomerListResponse>({ url: `/system/basic/customer/list`, params });
/**
 * 客户信息详情
 */
export const apiGetCustomerDetailsPath = (id: string | number) =>
  defHttp.get<IGetRawCustomerDetailsResponse>({ url: `/system/basic/customer/details/${id}` });
/**
 * 客户编号是否唯一
 */
export const apiGetCustomerCheckNumberIsExistQuery = (
  params: IGetCustomerCheckNumberIsExistQuery,
) => defHttp.get({ url: `/system/basic/customer/checkNumberIsExist`, params });
/**
 * 新增客户信息
 */
export const apiPostCustomerAdd = (params: IPostCustomerAddRequest) =>
  defHttp.post({ url: `/system/basic/customer/add`, params });
